












#include "kfirstrun.h"
#include "ui_kfirstrun.h"

kFirstRun::kFirstRun(QWidget *parent) :
    QDialog(parent),
    m_ui(new Ui::kFirstRun)
{
       m_ui->setupUi(this);

       m_ui->btnBack->setEnabled( false );
       currentPageIsOK = true;
}

void kFirstRun::on_btnNext_clicked()
{
    if( m_ui->stackedWidget->currentIndex() <= 1 )
        m_ui->stackedWidget->setCurrentIndex( m_ui->stackedWidget->currentIndex() +1 );
}

void kFirstRun::on_btnBack_clicked()
{
    if( m_ui->stackedWidget->currentIndex() >= 0 )
        m_ui->stackedWidget->setCurrentIndex( m_ui->stackedWidget->currentIndex() -1 );
}

void kFirstRun::on_stackedWidget_currentChanged(int page)
{
    page == 0 ? m_ui->btnBack->setEnabled( false ) : m_ui->btnBack->setEnabled( true );

    if( page != 2 )
        m_ui->btnNext->setText( tr("Siguiente"));

    if (page == 2 )
    {
        m_ui->btnNext->setEnabled( false );
        m_ui->btnNext->setText( tr("Finalizar"));
    }

    if( currentPageIsOK )
        m_ui->btnNext->setEnabled( true );
}
